package com.zhou.learn.dao;

import com.zhou.entities.Provider;
import org.apache.ibatis.annotations.*;

/**
 * mybatis注解版
 */
@Mapper
public interface MybatisAnnotationMapper {

    @Select("select * from provider where pid = #{pid}")
    Provider queryProviderByPid(Integer pid);

    @Options(useGeneratedKeys = true, keyProperty = "pid")
    @Insert("insert into provider(provider_code) values(#{providerCode})")
    int insertProvider(Provider provider);

    @Delete("delete from provider where pid = #{pid}")
    int deleteProvider(Integer pid);

    @Update("update provider set provider_code=#{providerCode} where pid = #{pid}")
    int updateProvider(Provider provider);
}
